import time

from selenium import webdriver
#加载驱动
from selenium.webdriver.common.by import By
chrome=webdriver.Chrome("chromedriver.exe")

#获取驱动
chrome.get("https://www.baidu.com/")

#获取id
chrome.find_element_by_id("kw").send_keys("nihao")
chrome.find_element(By.ID,"kw").send_keys("nihao")
time.sleep(3)

chrome.find_element(By.ID,"kw").clear()
time.sleep(3)

chrome.find_element(By.ID,"kw").send_keys("nihao")
time.sleep(3)

#点击元素
chrome.find_element(By.ID,"su").click()

el=chrome.find_element(By.ID,"kw")
#获取元素大小
print(el.size)
print(el.text)
#获取元素属性值
print(el.get_attribute("id"))
#获取元素是否可见
print(el.is_displayed())
#获取元素是否可用
print(el.is_enabled())
